﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace AlarmClock
{
    public partial class MediaPlayer : Form
    {
        //private int sound;
        private int musicId;
        private DataBase database;

        public MediaPlayer(int musicId,DataBase database)
        {
            InitializeComponent();
            this.musicId = musicId;
            this.database = database;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            String musicname;
            if (musicId < 0) musicname = "Dala.mp3";
            else musicname = database.findMusic(musicId);
            axWindowsMediaPlayer1.URL = musicname;
            this.Text = musicname.Contains("Dala.mp3") ? "闹铃" : ("闹铃-[" + musicname + "]");
            musicname = null;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        public void close()
        {
            this.Close();
        }
    }
}
